<?php
namespace Monkey;

/**
 * 控制器管理器\Monkey\ControllManager
 * @package    Monkey
 * @author     HuangYi
 * @copyright  Copyright (c) 2011-07-01——2013-03-30
 * @license    New BSD License
 * @version    $Id: \Monkey\ControllManager.php 版本号 2013-03-30 $
 */
class ControllManager
{
    private static $_controller_ini_file='/config/controller.ini.php';
    private static $_instance;
    private function __construct(){}
    public static function _instance(){
        !self::$_instance and self::$_instance=new self();
        return self::$_instance;
    }
    /*
     * 获取控制器配置，开发时用controller.ini.php，发布后改到缓存中
     */
    public function get($file=null){
        static $controllers=false;
        if($file || $controllers===false){
            !$file and $file=SYSTEM.self::$_controller_ini_file;
            $controllers=include($file);
        }
        return $controllers;
    }
    public function save($list,$file=null){
        !$file and $file=SYSTEM.self::$_controller_ini_file;
        fileSaveVariable($file, $list);
    }

}